import {request, config} from 'utils'

const {api} = config
const {

  findAllArticleUrl,
  insertArticleUrl,
  removeArticleUrl,
  removesArticleUrl,
  updateArticleUrl,

  findAllPubArticleUrl,
  insertArticlePubUrl,
  removeArticlePubUrl,
  removesArticlePubUrl,
  // removeArticlePubsUrl,
  findPortletToPubUrl,
  getPubArticleUrl,
} = api.content.article

//请求已录入文章 table数据
export function findAllArticle (params) {
  return request({
    url: findAllArticleUrl,
    method: 'get',
    data: params,
  })
}

//创建文章
export function insertArticle (params) {
  return request({
    url: insertArticleUrl,
    method: 'post',
    data: params,
  })
}

//table单选删除
export function removeArticle (params) {
  return request({
    url: removeArticleUrl,
    method: 'get',
    data: params,
  })
}

//多选删除
export function removeArticles (params) {
  return request({
    url: removesArticleUrl,
    method: 'get',
    data: params,
  })
}

//编辑完后重新请求table数据
export function updateArticle (params) {
  return request({
    url: updateArticleUrl,
    method: 'post',
    data: params,
  })
}

//切换tab时获取全部发布完文章的数据
export function findAllPubArticle (params) {
  return request({
    url: findAllPubArticleUrl,
    method: 'get',
    data: params,
  })
}

//获取发布完文章的数据
export function insertArticlePub (params) {
  return request({
    url: insertArticlePubUrl,
    method: 'get',
    data: params,
  })
}

// 已发布文章 单选删除
export function removeArticlePub (params) {
  return request({
    url: removeArticlePubUrl,
    method: 'get',
    data: params,
  })
}

export function removesArticlePub (params) {
  return request({
    url: removesArticlePubUrl,
    method: 'get',
    data: params,
  })
}

/**
 * TODO 获取全部可发布位置
 */
export function findPortletToPub (params) {
  return request({
    url: findPortletToPubUrl,
    method: 'get',
    data: params,
  })
}

